/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package upeu.edu.pe.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author YAKELYN
 */
@Entity
@Table(name = "SAU_EAP")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SauEap.findAll", query = "SELECT s FROM SauEap s"),
    @NamedQuery(name = "SauEap.findByIdEap", query = "SELECT s FROM SauEap s WHERE s.idEap = :idEap"),
    @NamedQuery(name = "SauEap.findByNombre", query = "SELECT s FROM SauEap s WHERE s.nombre = :nombre")})
public class SauEap implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID_EAP")
    private BigDecimal idEap;
    @Basic(optional = false)
    @Column(name = "NOMBRE")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEap")
    private Collection<SauEapFacultad> sauEapFacultadCollection;

    public SauEap() {
    }

    public SauEap(BigDecimal idEap) {
        this.idEap = idEap;
    }

    public SauEap(BigDecimal idEap, String nombre) {
        this.idEap = idEap;
        this.nombre = nombre;
    }

    public BigDecimal getIdEap() {
        return idEap;
    }

    public void setIdEap(BigDecimal idEap) {
        this.idEap = idEap;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<SauEapFacultad> getSauEapFacultadCollection() {
        return sauEapFacultadCollection;
    }

    public void setSauEapFacultadCollection(Collection<SauEapFacultad> sauEapFacultadCollection) {
        this.sauEapFacultadCollection = sauEapFacultadCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEap != null ? idEap.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SauEap)) {
            return false;
        }
        SauEap other = (SauEap) object;
        if ((this.idEap == null && other.idEap != null) || (this.idEap != null && !this.idEap.equals(other.idEap))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "upeu.edu.pe.modelo.SauEap[ idEap=" + idEap + " ]";
    }
    
}
